﻿using SqlSugar;

namespace Zhp.Workflow.Entity
{
    [SugarTable("Elsa.WorkflowInstances")]
    public class Elsa_WorkflowInstance
    {
        [SugarColumn(IsPrimaryKey = true, Length = 450, ColumnDescription = "ID主键")]
        public string Id { get; set; }

        [SugarColumn(IsNullable = false, Length = 450, ColumnDescription = "流程ID")]
        public string DefinitionId { get; set; }

        [SugarColumn(IsNullable = true, Length = 450, ColumnDescription = "租户ID")]
        public string TenantId { get; set; }

        [SugarColumn(IsNullable = false, ColumnDescription = "流程版本")]
        public int Version { get; set; }

        [SugarColumn(IsNullable = false, ColumnDescription = "流程状态")]
        public int WorkflowStatus { get; set; }

        [SugarColumn(IsNullable = false, Length = 450)]
        public string CorrelationId { get; set; }

        [SugarColumn(IsNullable = true, Length = 450, ColumnDescription = "对应的实体类型全名称")]
        public string ContextType { get; set; }

        [SugarColumn(IsNullable = true, Length = 450, ColumnDescription = "对应的实体ID")]
        public string ContextId { get; set; }

        [SugarColumn(IsNullable = true, Length = 450, ColumnDescription = "流程名称")]
        public string Name { get; set; }

        [SugarColumn(IsNullable = false, ColumnDescription = "创建时间")]
        public DateTimeOffset CreatedAt { get; set; }

        [SugarColumn(IsNullable = true, ColumnDescription = "最后执行时间")]
        public DateTimeOffset? LastExecutedAt { get; set; }

        [SugarColumn(IsNullable = true, ColumnDescription = "完成时间")]
        public DateTimeOffset? FinishedAt { get; set; }

        [SugarColumn(IsNullable = true, ColumnDescription = "取消时间")]
        public DateTimeOffset? CancelledAt { get; set; }

        [SugarColumn(IsNullable = true, ColumnDescription = "失败时间")]
        public DateTimeOffset? FaultedAt { get; set; }

        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(max)", ColumnDescription = "审批过程中的数据")]
        public string Data { get; set; }

        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(max)", ColumnDescription = "最后执行的活动ID")]
        public string LastExecutedActivityId { get; set; }

        [SugarColumn(IsNullable = false, Length = 450, ColumnDescription = "流程版本ID")]
        public string DefinitionVersionId { get; set; }

    }
}
